<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en" style="overflow-x: hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="initial-scale=1.0,maximum-scale=1.0,user-scalable=yes">
<meta name="format-detection" content="telephone=yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet" href="<%=commonPath%>/pageRc/layui/css/layui.css"
	media="all">
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/layui/layui.js"></script>

<title>待评价需求</title>

<script>
	$(function(){

 	})
	//注意：选项卡 依赖 element 模块，否则无法进行工能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	});
</script>
<jsp:include page="publicMethod.jsp"/>
</head>
<body class="layui-main">
	<blockquote class="layui-elem-quote">待评价需求</blockquote>
	<div class="layui-form-item ">
		<form id="createMsgForm" name="createMsgForm" action="" class="layui-form">
			<div class="layui-form-item">
				<div class="layui-inline">
					<div class="layui-inline">
						<select name="proGroupNo" id="proGroupNo" class="layui-input"
							lay-filter="proGroupSelect" style="width: 210;">
							<c:forEach items="${groupList}" var="group">
								<option value="${group.proGroupNo}">${group.proGroupName}</option>
							</c:forEach>
						</select>
					</div>
					<div class="layui-inline">
						<select name="proTeamNo" id="proTeamNo" style="width: 210;"
							class="layui-input">
							<option value="">项目组名称</option>
							<option value="">全部</option>
							<c:forEach items="${teanList}" var="tean">
								<option value="${tean.proTeamNo}">${tean.proTeamName}</option>
							</c:forEach>
						</select>
					</div>
					<div class="layui-inline">
						<input class="layui-input" style="width: 210" id="needName"
							placeholder="需求名称">
					</div>
					<div class="layui-inline">-</div>
					<div class="layui-inline">
						<button class="layui-btn" id="searchbutton" type="button" data-method="doSearchSum">查询</button>
					</div>
				</div>
			</div>


			<div class="layui-form-item">
				<div class="layui-inline">
					<input class="layui-input" style="width: 210" id="startDate"
						value="${sysdate}"
						onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
						placeholder="报工日期从">
				</div>
				<div class="layui-inline">
					<input class="layui-input" style="width: 210" id="endDate"
						value="${sysdate}"
						onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
						placeholder="到">
				</div>
				<div class="layui-inline">
					<div class="layui-inline">
						<input class="layui-input" style="width: 210" id="needNo"
							placeholder="需求编号">
					</div>
				</div>
				<div class="layui-inline">
					<div>
						<input class="layui-btn" id="subSelNeed" type="button"
							style="width: 210" value="打分评价">
					</div>
				</div>
			</div>
			<div class="layui-form-item" id="dateDiv">
				<div class="layui-inline">
					<table class="layui-table" style="text-align: center;">
						<thead>
							<tr>
								<th width="150" style="text-align: center"><input
									type="checkbox" id="all" lay-ignore/></th>
								<th width="150" style="text-align: center">需求编号</th>
								<th width="150" style="text-align: center">项目组名称</th>
								<th width="150" style="text-align: center">需求名称</th>
								<th width="150" style="text-align: center">评价等级</th>
								<!-- <th width="150" style="text-align: center">评价人</th>
								<th width="150" style="text-align: center">评价备注</th> -->
							</tr>
						</thead>
						<tbody id="detailDiv">

						</tbody>
						<script id="tplSrc" type="text/html">
							 {{#  layui.each(d.body, function(index, x){}}
							     <tr>
								   <td width="150"><input type="checkbox" value={{x.rouid==undefined?'':x.rouid}} class='che' lay-ignore/></td>
								   <td width="150">{{x.needNo==undefined?'':x.needNo}}</td>
								   <td width="150">{{x.proTeamName==undefined?'':x.proTeamName}}</td>
								   <td width="150">{{x.needName==undefined?'':x.needName}}</td>
								   <td width="150">{{x.rank==undefined?'':x.rank}}</td>
 							    </tr>
							{{#  }); }} 
					   </script>
					    		   <!-- <td width="150">{{x.commentUser==undefined?'':x.commentUser}}</td>
                                   <td width="150">{{x.commentDesc==undefined?'':x.commentDesc}}</td> -->
					   
					</table>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
					<div id="laypageDiv"></div>
				</div>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
	var msg = new msgTool();
	layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
	function() {
	var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
						var form = layui.form(), layer = layui.layer, laypage = layui.laypage, laytpl = layui.laytpl;
						var active = {
							doSearchSum : function() { //搜索
								var getTpl = tplSrc.innerHTML;
								var dataObj = {
									"proGroupNo" : $("#proGroupNo").val(),
									"proTeamNo" : $("#proTeamNo").val(),
									"needNo" : $("#needNo").val(),
									"needName" : $("#needName").val(),
									"startDate":$("#startDate").val(),
									"endDate":$("#endDate").val(),
								/* "bgnWorkDate" : $("#startDate").val(),
								"endWorkDate" : $("#endDate").val() */
								}
								console.info(dataObj);
								msg.sendMsg("/page/main/searchWaitCommentNeed.do",
									dataObj,function(data) {laytpl(getTpl).render(data,
												function(html) {
												detailDiv.innerHTML = html;
												form.render('checkbox');
												});
										});
							}
	}
	$('.layui-btn').on('click',function() {
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this,othis) : '';
	});
					});

	layui.use([ 'jquery' ], function() {
		var $ = jQuery;
		$("#all").click(function() {
			$(".che").prop("checked", $(this).prop("checked"));
		})
		$("#subSelNeed").click(function() {
			var arr = new Array();
			$(".che:checked").each(function(i) {
				arr[i] = $(this).val();
			})
			if(arr.length <=0){
				layer.alert("没有选择任何上线需求！");
				return false;
			}else{
				var checkedRouId = arr.join(",");
				var pars = "rouid="+checkedRouId;
		    	layer.open({
		    		 type: 2,
		             title:"打分评价",
		             area: ['400px', '250px'],
		             scrollbar: false,
		             content: '<%=commonPath %>/page/main/judgeNeedComment.do?'+pars,
		             success: function (layero, index) {
		             },
		             end: function () {
		             }
		    	})
			}
			//console.info(JSON.stringify(arr));
		})
	})
	
	function flush(){
        $('#searchbutton').click()
    }
</script>
</html>